<template>
	<view>
		<fui-form-item label="群名称">
			<fui-input textAlign="right" disabled :borderBottom="false" :padding="[0]" v-model="GroupInfo.MsgGroupName"
				placeholder="群名称"></fui-input>
		</fui-form-item>
		<fui-textarea placeholder="群公告" disabled :value="GroupInfo.MsgGroupNotice"></fui-textarea>
		<fui-form-item label="群昵称">
			<fui-input textAlign="right" :borderBottom="false" :padding="[0]" v-model="GroupMember.MsgGroupMemberName"
				placeholder="群昵称"></fui-input>
		</fui-form-item>
		<fui-form-item label="置顶">
			<fui-switch :scaleRatio="0.8" color="#FFB703" @change="change"></fui-switch>
		</fui-form-item>
		<fui-form-item>
			<button type="primary" size="mini" class="exitBtn" @click="onExitGroup">退出群组</button>
		</fui-form-item>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				GroupInfo: {},
				GroupMember: {},
			};
		},
		onLoad(option) {
			this.MsgGroupID = option.groupid
			console.log('MsgGroupID', this.MsgGroupID)

			this.loadGroupSet();

		},
		onUnload() {
			console.log('卸载触发了~~~~~~~~')
			this.updateGroupMessageInfo()
		},
		methods: {
			// 退出群组
			onExitGroup() {

			},
			// 更新群组内信息
			updateGroupMessageInfo() {
				console.log('更新群组信息', this.GroupMember)
			},
			loadGroupSet() {
				this.$httpost('/Message/groupSet', {
					MsgGroupID: this.MsgGroupID
				}).then(res => {

					if (res.code == 200) {
						this.GroupInfo = res.data.GroupInfo
						this.GroupMember = res.data.GroupMember

						uni.setNavigationBarTitle({
							title: this.GroupInfo.MsgGroupName
						})
					}
				});
			},
			saveGroupSet() {
				// this.$httpost('/Message/groupSet', {
				// 	MsgGroupID: this.MsgGroupID
				// }).then(res => {
				// 	console.log('groupSet', res)
				// 	if (res.code == 200) {

				// 	}
				// });
			}
		}
	}
</script>

<style lang="scss">
	.exitBtn {
		background-color: $globalColor;
		color: #000
	}
</style>